package code

import (
	"encoding/base64"
)

func Base64EncodeString(src string) string {
	return Base64Encode([]byte(src))
}

func Base64Encode(src []byte) string {
	return base64.StdEncoding.EncodeToString(src)
}

func Base64DecodeString(src string) []byte {
	dest, err := base64.StdEncoding.DecodeString(src)
	if err != nil {
		panic(err)
	}
	return dest
}

func Base64Decode(src []byte) []byte {
	return Base64DecodeString(string(src))
}
